tic
clear all
close all

%loc=zeros(360,3);
%vel=zeros(360,3);

for i=1:5
	%[loc(i,:),vel(i,:)]=orb2state(286.4886,58.6833, 6.72e6,.0005432,51.6448,i/10,398600);
	%[loc(i,:),vel(i,:)]=orb2state(285.93045,69.20824,6729788.61,0.5,51.31654,i/10,398600);
	[loc(i,:),vel(i,:)]=orb2state2(6729788,...
									.0010932,...
									51,...
									154.3,...
									69.20824,...
									398600,...
									i);
end
[x,y,z]=sphere(20);
x=x*6.3e6;
y=y*6.3e6;
z=z*6.3e6;
surf(x,y,z);
hold on;
h1=plot3(loc(:,1),loc(:,2),loc(:,3),'-r');
axis equal
grid on;
set(get(h1,'parent'),'cameraviewanglemode','manual');

figure(2);
subplot(2,2,1);
plot(vel(:,1));
title('Vel. x');
subplot(2,2,2);
plot(vel(:,2));
title('Vel. y');
subplot(2,2,3);
plot(vel(:,3));
title('Vel. z');

drawnow;

for i=1:length(vel)
	normVel(i)=norm(vel(i,:));
end

subplot(2,2,4);
plot(normVel);
title('Vel. Total');

toc